<template lang="html">
    <div class="training_box">
       <div v-for="(item,index) in Coach">
           <img :src="item.icon"/>
           <p>{{ item.username }}</p>
           <span>{{ item.sign }}</span>
           <button @click="btnclick(item)" >预约</button>
        </div>
        <div @click="getMoreHandler" class="infinite-status-click more">查看更多...</div>
    </div>
    </div>
</template>

<script>
export default {
    name:"TrainingData",
    data(){
        return{
            Coach:[],
            markFlag:false
        }
    },
   mounted () {
       this.getCoach()  //第一次调用
   },
   methods:{
       btnclick(item){   //点击获取教练信息
           console.log(item)
       },
       getMoreHandler(event){   //点击加载更多
           this.getCoach()
       },
       getCoach(){
        this.$axios.get(this.HOST + "http://localhost:3000/burning/coach")
        .then(res => {
                var allData = this.Coach.concat(res.data)
                this.Coach = allData
        })
        .catch(error => {
        console.log(error)
        })
       }
   }

   

}
</script>

<style lang="less">
.mark,.more{
    font-size: 0.4rem;
    text-align: center;
}
.training_box{
    height: 720px;
    div{
        width: 100%;
        height: 1.5rem;
        background: white;
        margin-bottom: 10px;
        padding-top: 0.25rem;
        box-sizing: border-box;
        position: relative;
        padding-left: 0.3rem;

        img{
            height: 1rem;
        }
        p{
            font-size: 0.4rem;
            position: absolute;
            top:0.25rem;
            left: 1.5rem;
        }
        span{
            font-size: 0.3rem;
            position: absolute;
            left: 1.5rem;
            bottom: 10px;
            width: 90px;
            height: 20px;
            overflow:hidden;
            text-overflow:ellipsis;
            white-space:nowrap
        }
        button{
            font-size: 0.3rem;
            width: 2rem;
            height: 0.7rem;
            position: absolute;
            right: 0.4rem;
            top: 0.4rem;
            background: rgba(254,217,5);
            border-radius: 20px;
            color: #666;
            outline: none;  
        }
    }
    
}

</style>
